package com.hh.demo.feignClient;

import com.hh.demo.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author 黄浩
 * @create 2022-07-18 10:09
 */
@Component
public class UserFeignClientFallbackFactory implements FallbackFactory<UserFeignClient> {
    @Override
    public UserFeignClient create(Throwable throwable) {
        return new UserFeignClient() {
            @Override
            public JSONResult getUserByTel(String tel) {
                throwable.printStackTrace();
                return JSONResult.error("user服务出了点问题。。");
            }
        };
    }
}
